# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>

_pkgname=pypatchelf
pkgname=python-$_pkgname
_commit=c8b0b622ead44f15c68fe92e5c4606797d0dcdff
pkgver=0.9
pkgrel=4
pkgdesc='Patchelf utility, packaged for python/pip'
arch=('any')
url='https://github.com/rmcgibbo/pypatchelf'
license=('GPL3')
depends=('python' 'patchelf')
makedepends=('python-setuptools')
source=("$pkgname-$pkgver.tar.gz::$url/archive/$_commit.tar.gz")
sha512sums=('e1e76717b773ae768191675a9298c8ed60fb969e93eeae46f3dc46ce5066802405179e268639b891b7c5454d8fb4ce77f6ecc1cbf54b12e17d6387fceb6b63bd')

prepare() {
  cd $_pkgname-$_commit

  sed -i "s|'build_ext': build_ext||
          s|'patchelf = pypatchelf:main',||
          /ext_modules/d" setup.py
  sed -i 's|PATCHELF =.*|PATCHELF = "/usr/bin/patchelf"|' pypatchelf/__init__.py
}

build() {
  cd $_pkgname-$_commit

  python setup.py build
}

package() {
  cd $_pkgname-$_commit

  python setup.py install --root="$pkgdir" --optimize=1 --skip-build

  install -Dm 644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

# vim:set ts=2 sw=2 et:
